<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix='fmt'%>
<%@ taglib uri="/tags/trymore" prefix="tm"%>

<script>
	$(function(){
		$("#export_prof").click(function(){
			$.post("app/proficient.do?action=actionExportProficient", {
				"fullName"		: $("#q_fullName").val(),
				"companyName"	: $("#q_companyName").val(),
				"researchArea"	: $("#q_researchArea").val()
			}, function(rsp){
				var feedback = eval('(' + rsp + ')');
				if (feedback.status && feedback.status == 200) 
				{
					var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no,resizable=yes,personalbar=no,scrollbars=yes"; 
					window.open("file-download?path="+feedback.file+"&filename="+feedback.name, "_blank",  windowAttr);
				} 
				else 
				{
					// error message migtht be raised here.
					alert(feedback.message);
				}
			});
		});
	});
</script>

<div id="group_wrapper">
	<form id="pagerForm" method="post" action="app/proficient.do?action=pageProficientIndex">
		<input type="hidden" name="pageNum" value="${pagingBean ne null ? pagingBean.currentPage : 1}" />
		<input type="hidden" name="numPerPage" value="${pagingBean ne null ? pagingBean.pageSize : 20}" />
	</form>
	
	<!-- SearchBar -->
	<div class="pageHeader">
		<form onsubmit="return navTabSearch(this);" action="app/proficient.do?action=pageProficientIndex" 
			method="post" id="searchForm" rel="pagerForm">
			<div class="searchBar">
				<table class="searchContent">
					<tr>
						<td>
							<label>专家姓名：</label>
							<input id="q_fullName" type="text" name="fullName" rel="pagerForm" value="${fullName ne null ? fullName : ''}" />
						</td>
						<td>
							<label>单位名称：</label>
							<input id="q_companyName" type="text" name="companyName" rel="pagerForm" value="${companyName ne null ? companyName : ''}"  />
						</td>
						<td>
							<label>研究方向：</label>
							<input id="q_researchArea" type="text" name="researchArea" rel="pagerForm" value="${researchArea ne null ? researchArea : ''}" />
						</td>
					</tr>
				</table>
				<div class="subBar">
					<ul>
						<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
					</ul>
				</div>
			</div>
		</form>
	</div>
	
	<!-- Body -->	
	<div class="pageContent">
		<div class="panelBar">
			<ul class="toolBar">
				<li>
					<a class="add" href="app/proficient.do?action=dialogProficientPage" 
						target="dialog" title="添加新专家" mask="true" width="900" height="570" rel="dia_proficient_add">
						<span>添加新专家</span>
					</a>
				</li>
				<li>
					<a class="delete" href="app/proficient.do?action=dialogProficientImportPage" 
						target="dialog" title="导入专家信息" mask="true" width="425" height="238" rel="dia_proficient_import">
						<span>导入</span>
					</a>
				</li>
				<li>
					<a class="icon" id="export_prof" href="javascript:void(0);" title="添加新专家">
						<span>导出</span>
					</a>
				</li>
			</ul>
		</div>
		
		<%@ include file="datagrid/dataGridProficient.jsp" %>
		
	</div>
</div>